3.3.11 \(\int \cos ^2(c+d x) \sin (a+b x) \, dx\) [211]

Optimal. Leaf size=62 \[ -\frac {\cos (a+b x)}{2 b}-\frac {\cos (a-2 c+(b-2 d) x)}{4 (b-2 d)}-\frac {\cos (a+2 c+(b+2 d) x)}{4 (b+2 d)} \]

[Out]

-1/2*cos(b*x+a)/b-1/4*cos(a-2*c+(b-2*d)*x)/(b-2*d)-1/4*cos(a+2*c+(b+2*d)*x)/(b+2*d)

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 2, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {4670, 2718} \begin {gather*} -\frac {\cos (a+x (b-2 d)-2 c)}{4 (b-2 d)}-\frac {\cos (a+x (b+2 d)+2 c)}{4 (b+2 d)}-\frac {\cos (a+b x)}{2 b} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*Sin[a + b*x],x]

[Out]

-1/2*Cos[a + b*x]/b - Cos[a - 2*c + (b - 2*d)*x]/(4*(b - 2*d)) - Cos[a + 2*c + (b + 2*d)*x]/(4*(b + 2*d))

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 4670

Int[Cos[w_]^(q_.)*Sin[v_]^(p_.), x_Symbol] :> Int[ExpandTrigReduce[Sin[v]^p*Cos[w]^q, x], x] /; IGtQ[p, 0] &&
IGtQ[q, 0] && ((PolynomialQ[v, x] && PolynomialQ[w, x]) || (BinomialQ[{v, w}, x] && IndependentQ[Cancel[v/w],
x]))

Rubi steps

\begin {align*} \int \cos ^2(c+d x) \sin (a+b x) \, dx &=\int \left (\frac {1}{2} \sin (a+b x)+\frac {1}{4} \sin (a-2 c+(b-2 d) x)+\frac {1}{4} \sin (a+2 c+(b+2 d) x)\right ) \, dx\\ &=\frac {1}{4} \int \sin (a-2 c+(b-2 d) x) \, dx+\frac {1}{4} \int \sin (a+2 c+(b+2 d) x) \, dx+\frac {1}{2} \int \sin (a+b x) \, dx\\ &=-\frac {\cos (a+b x)}{2 b}-\frac {\cos (a-2 c+(b-2 d) x)}{4 (b-2 d)}-\frac {\cos (a+2 c+(b+2 d) x)}{4 (b+2 d)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.83, size = 71, normalized size = 1.15 \begin {gather*} \frac {1}{4} \left (-\frac {2 \cos (a) \cos (b x)}{b}-\frac {\cos (a-2 c+b x-2 d x)}{b-2 d}-\frac {\cos (a+2 c+b x+2 d x)}{b+2 d}+\frac {2 \sin (a) \sin (b x)}{b}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*Sin[a + b*x],x]

[Out]

((-2*Cos[a]*Cos[b*x])/b - Cos[a - 2*c + b*x - 2*d*x]/(b - 2*d) - Cos[a + 2*c + b*x + 2*d*x]/(b + 2*d) + (2*Sin
[a]*Sin[b*x])/b)/4

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 57, normalized size = 0.92

method result size
default \(-\frac {\cos \left (b x +a \right )}{2 b}-\frac {\cos \left (a -2 c +\left (b -2 d \right ) x \right )}{4 \left (b -2 d \right )}-\frac {\cos \left (a +2 c +\left (b +2 d \right ) x \right )}{4 \left (b +2 d \right )}\) \(57\)
risch \(-\frac {\cos \left (b x +a \right )}{2 b}-\frac {\cos \left (b x -2 d x +a -2 c \right )}{4 \left (b -2 d \right )}-\frac {\cos \left (b x +2 d x +a +2 c \right )}{4 \left (b +2 d \right )}\) \(57\)
norman \(\frac {\frac {-2 b^{2}+4 d^{2}}{b \left (b^{2}-4 d^{2}\right )}+\frac {\left (-2 b^{2}+4 d^{2}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b \left (b^{2}-4 d^{2}\right )}-\frac {8 d \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{b^{2}-4 d^{2}}+\frac {8 d \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{2}-4 d^{2}}-\frac {4 b \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{2}-4 d^{2}}+\frac {8 d^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b \left (b^{2}-4 d^{2}\right )}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}\) \(228\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*sin(b*x+a),x,method=_RETURNVERBOSE)

[Out]

-1/2*cos(b*x+a)/b-1/4*cos(a-2*c+(b-2*d)*x)/(b-2*d)-1/4*cos(a+2*c+(b+2*d)*x)/(b+2*d)

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 414 vs. \(2 (56) = 112\).
time = 0.30, size = 414, normalized size = 6.68 \begin {gather*} -\frac {{\left (b^{2} \cos \left (2 \, c\right ) - 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left ({\left (b + 2 \, d\right )} x + a + 4 \, c\right ) + {\left (b^{2} \cos \left (2 \, c\right ) - 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left ({\left (b + 2 \, d\right )} x + a\right ) + {\left (b^{2} \cos \left (2 \, c\right ) + 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left (-{\left (b - 2 \, d\right )} x - a + 4 \, c\right ) + {\left (b^{2} \cos \left (2 \, c\right ) + 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left (-{\left (b - 2 \, d\right )} x - a\right ) + 2 \, {\left (b^{2} \cos \left (2 \, c\right ) - 4 \, d^{2} \cos \left (2 \, c\right )\right )} \cos \left (b x + a + 2 \, c\right ) + 2 \, {\left (b^{2} \cos \left (2 \, c\right ) - 4 \, d^{2} \cos \left (2 \, c\right )\right )} \cos \left (b x + a - 2 \, c\right ) + {\left (b^{2} \sin \left (2 \, c\right ) - 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left ({\left (b + 2 \, d\right )} x + a + 4 \, c\right ) - {\left (b^{2} \sin \left (2 \, c\right ) - 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left ({\left (b + 2 \, d\right )} x + a\right ) + {\left (b^{2} \sin \left (2 \, c\right ) + 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left (-{\left (b - 2 \, d\right )} x - a + 4 \, c\right ) - {\left (b^{2} \sin \left (2 \, c\right ) + 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left (-{\left (b - 2 \, d\right )} x - a\right ) + 2 \, {\left (b^{2} \sin \left (2 \, c\right ) - 4 \, d^{2} \sin \left (2 \, c\right )\right )} \sin \left (b x + a + 2 \, c\right ) - 2 \, {\left (b^{2} \sin \left (2 \, c\right ) - 4 \, d^{2} \sin \left (2 \, c\right )\right )} \sin \left (b x + a - 2 \, c\right )}{8 \, {\left (b^{3} \cos \left (2 \, c\right )^{2} + b^{3} \sin \left (2 \, c\right )^{2} - 4 \, {\left (b \cos \left (2 \, c\right )^{2} + b \sin \left (2 \, c\right )^{2}\right )} d^{2}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*sin(b*x+a),x, algorithm="maxima")

[Out]

-1/8*((b^2*cos(2*c) - 2*b*d*cos(2*c))*cos((b + 2*d)*x + a + 4*c) + (b^2*cos(2*c) - 2*b*d*cos(2*c))*cos((b + 2*
d)*x + a) + (b^2*cos(2*c) + 2*b*d*cos(2*c))*cos(-(b - 2*d)*x - a + 4*c) + (b^2*cos(2*c) + 2*b*d*cos(2*c))*cos(
-(b - 2*d)*x - a) + 2*(b^2*cos(2*c) - 4*d^2*cos(2*c))*cos(b*x + a + 2*c) + 2*(b^2*cos(2*c) - 4*d^2*cos(2*c))*c
os(b*x + a - 2*c) + (b^2*sin(2*c) - 2*b*d*sin(2*c))*sin((b + 2*d)*x + a + 4*c) - (b^2*sin(2*c) - 2*b*d*sin(2*c
))*sin((b + 2*d)*x + a) + (b^2*sin(2*c) + 2*b*d*sin(2*c))*sin(-(b - 2*d)*x - a + 4*c) - (b^2*sin(2*c) + 2*b*d*
sin(2*c))*sin(-(b - 2*d)*x - a) + 2*(b^2*sin(2*c) - 4*d^2*sin(2*c))*sin(b*x + a + 2*c) - 2*(b^2*sin(2*c) - 4*d
^2*sin(2*c))*sin(b*x + a - 2*c))/(b^3*cos(2*c)^2 + b^3*sin(2*c)^2 - 4*(b*cos(2*c)^2 + b*sin(2*c)^2)*d^2)

________________________________________________________________________________________

Fricas [A]
time = 2.96, size = 66, normalized size = 1.06 \begin {gather*} -\frac {b^{2} \cos \left (b x + a\right ) \cos \left (d x + c\right )^{2} + 2 \, b d \cos \left (d x + c\right ) \sin \left (b x + a\right ) \sin \left (d x + c\right ) - 2 \, d^{2} \cos \left (b x + a\right )}{b^{3} - 4 \, b d^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*sin(b*x+a),x, algorithm="fricas")

[Out]

-(b^2*cos(b*x + a)*cos(d*x + c)^2 + 2*b*d*cos(d*x + c)*sin(b*x + a)*sin(d*x + c) - 2*d^2*cos(b*x + a))/(b^3 -
4*b*d^2)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 408 vs. \(2 (51) = 102\).
time = 0.80, size = 408, normalized size = 6.58 \begin {gather*} \begin {cases} x \sin {\left (a \right )} \cos ^{2}{\left (c \right )} & \text {for}\: b = 0 \wedge d = 0 \\\left (\frac {x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {\sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d}\right ) \sin {\left (a \right )} & \text {for}\: b = 0 \\- \frac {x \sin {\left (a - 2 d x \right )} \sin ^{2}{\left (c + d x \right )}}{4} + \frac {x \sin {\left (a - 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {x \sin {\left (c + d x \right )} \cos {\left (a - 2 d x \right )} \cos {\left (c + d x \right )}}{2} + \frac {3 \sin {\left (a - 2 d x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} + \frac {\sin ^{2}{\left (c + d x \right )} \cos {\left (a - 2 d x \right )}}{2 d} & \text {for}\: b = - 2 d \\- \frac {x \sin {\left (a + 2 d x \right )} \sin ^{2}{\left (c + d x \right )}}{4} + \frac {x \sin {\left (a + 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} - \frac {x \sin {\left (c + d x \right )} \cos {\left (a + 2 d x \right )} \cos {\left (c + d x \right )}}{2} + \frac {3 \sin {\left (a + 2 d x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} - \frac {\sin ^{2}{\left (c + d x \right )} \cos {\left (a + 2 d x \right )}}{2 d} & \text {for}\: b = 2 d \\- \frac {b^{2} \cos {\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{b^{3} - 4 b d^{2}} - \frac {2 b d \sin {\left (a + b x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{b^{3} - 4 b d^{2}} + \frac {2 d^{2} \sin ^{2}{\left (c + d x \right )} \cos {\left (a + b x \right )}}{b^{3} - 4 b d^{2}} + \frac {2 d^{2} \cos {\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{b^{3} - 4 b d^{2}} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*sin(b*x+a),x)

[Out]

Piecewise((x*sin(a)*cos(c)**2, Eq(b, 0) & Eq(d, 0)), ((x*sin(c + d*x)**2/2 + x*cos(c + d*x)**2/2 + sin(c + d*x
)*cos(c + d*x)/(2*d))*sin(a), Eq(b, 0)), (-x*sin(a - 2*d*x)*sin(c + d*x)**2/4 + x*sin(a - 2*d*x)*cos(c + d*x)*
*2/4 + x*sin(c + d*x)*cos(a - 2*d*x)*cos(c + d*x)/2 + 3*sin(a - 2*d*x)*sin(c + d*x)*cos(c + d*x)/(4*d) + sin(c
 + d*x)**2*cos(a - 2*d*x)/(2*d), Eq(b, -2*d)), (-x*sin(a + 2*d*x)*sin(c + d*x)**2/4 + x*sin(a + 2*d*x)*cos(c +
 d*x)**2/4 - x*sin(c + d*x)*cos(a + 2*d*x)*cos(c + d*x)/2 + 3*sin(a + 2*d*x)*sin(c + d*x)*cos(c + d*x)/(4*d) -
 sin(c + d*x)**2*cos(a + 2*d*x)/(2*d), Eq(b, 2*d)), (-b**2*cos(a + b*x)*cos(c + d*x)**2/(b**3 - 4*b*d**2) - 2*
b*d*sin(a + b*x)*sin(c + d*x)*cos(c + d*x)/(b**3 - 4*b*d**2) + 2*d**2*sin(c + d*x)**2*cos(a + b*x)/(b**3 - 4*b
*d**2) + 2*d**2*cos(a + b*x)*cos(c + d*x)**2/(b**3 - 4*b*d**2), True))

________________________________________________________________________________________

Giac [A]
time = 0.41, size = 56, normalized size = 0.90 \begin {gather*} -\frac {\cos \left (b x + 2 \, d x + a + 2 \, c\right )}{4 \, {\left (b + 2 \, d\right )}} - \frac {\cos \left (b x - 2 \, d x + a - 2 \, c\right )}{4 \, {\left (b - 2 \, d\right )}} - \frac {\cos \left (b x + a\right )}{2 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*sin(b*x+a),x, algorithm="giac")

[Out]

-1/4*cos(b*x + 2*d*x + a + 2*c)/(b + 2*d) - 1/4*cos(b*x - 2*d*x + a - 2*c)/(b - 2*d) - 1/2*cos(b*x + a)/b

________________________________________________________________________________________

Mupad [B]
time = 0.77, size = 97, normalized size = 1.56 \begin {gather*} \frac {d\,\left (2\,b\,\cos \left (a-2\,c+b\,x-2\,d\,x\right )-2\,b\,\cos \left (a+2\,c+b\,x+2\,d\,x\right )\right )+b^2\,\cos \left (a-2\,c+b\,x-2\,d\,x\right )+b^2\,\cos \left (a+2\,c+b\,x+2\,d\,x\right )}{16\,b\,d^2-4\,b^3}-\frac {\cos \left (a+b\,x\right )}{2\,b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*sin(a + b*x),x)

[Out]

(d*(2*b*cos(a - 2*c + b*x - 2*d*x) - 2*b*cos(a + 2*c + b*x + 2*d*x)) + b^2*cos(a - 2*c + b*x - 2*d*x) + b^2*co
s(a + 2*c + b*x + 2*d*x))/(16*b*d^2 - 4*b^3) - cos(a + b*x)/(2*b)

________________________________________________________________________________________